package com.template.app.utils;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * 输出工具类
 * @author chenshumei
 *
 */
public class OutPutUtil {
	/**
	 * 得到Json数据
	 * 
	 * @param obj
	 * @return
	 * @throws JsonProcessingException
	 */
	public static String getJsonStrByJsonByJackSon(Object obj) throws JsonProcessingException {
		ObjectMapper mapper = new ObjectMapper();
		StringBuffer result = new StringBuffer(); 
		//result.append("{");
		String souceResult = mapper.writeValueAsString(obj);
		result.append(souceResult);
		//result.append("}");
		return result.toString();
	}
}
